﻿using NPOI.DDF;
using Ozone.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Ozone.Views.Widget
{
    /// <summary>
    /// 信息警告错误对话框
    /// </summary>
    public partial class WindowPromptDialog : Window
    {
        public WindowPromptDialog()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 弹提示信息窗体
        /// </summary>
        /// <param name="dialogType">弹窗类型</param>
        /// <param name="promptInfo">提示信息</param>
        public WindowPromptDialog(string dialogType, string promptInfo)
        {
            InitializeComponent();
            SetDialogInfo(dialogType, promptInfo);
        }

        private void SetDialogInfo(string dialogType, string promptInfo)
        {
            if (dialogType == InfoEnum.DialogType.Warning.ToString())
            {
                lbTitle.Content = "警告";
                imgWarning.Visibility = Visibility.Visible;
                imgInfo.Visibility = Visibility.Collapsed;
                imgError.Visibility = Visibility.Collapsed;
            }
            else if (dialogType == InfoEnum.DialogType.Info.ToString())
            {
                lbTitle.Content = "信息";
                imgWarning.Visibility = Visibility.Collapsed;
                imgInfo.Visibility = Visibility.Visible;
                imgError.Visibility = Visibility.Collapsed;
            }
            else if (dialogType == InfoEnum.DialogType.Error.ToString())
            {
                lbTitle.Content = "错误";
                imgWarning.Visibility = Visibility.Collapsed;
                imgInfo.Visibility = Visibility.Collapsed;
                imgError.Visibility = Visibility.Visible;
            }
            else
            {
                lbTitle.Content = "警告";
                imgWarning.Visibility = Visibility.Visible;
                imgInfo.Visibility = Visibility.Collapsed;
                imgError.Visibility = Visibility.Collapsed;
            }
            lbInfo.Content = promptInfo;
        }

        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            this.Close();
        }
    }
}